package com.imooc.coupon.feign;

import com.imooc.coupon.feign.hystrix.TemplateClientHystrix;
import com.imooc.coupon.vo.CommonResponse;
import com.imooc.coupon.vo.CouponTemplateSDK;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * 优惠券模板微服务接口定义
 * @Author Administrator
 * @Date 2021/11/10 21:41
 * @Version 1.0
 */
@FeignClient(value = "eureka-client-coupon-settlement", fallback = TemplateClientHystrix.class)//想调用的微服务应用名称
public interface TemplateClient {

    /**
     * 查找所有可用的优惠券模板
     * @return
     */
    @RequestMapping(value="/coupom-template/template/sdk/all", method = RequestMethod.GET)
    CommonResponse<List<CouponTemplateSDK>> findAllUsableTemplate();
    /**
     * 获取idws模板到CouponTemplateSDK的映射
     * @return
     */
    @RequestMapping(value="/coupom-template/template/sdk/infos", method = RequestMethod.GET)
    CommonResponse<Map<Integer, CouponTemplateSDK>> findIds2TempklateSDK(@RequestParam("ids") Collection<Integer> ids);


}
